
import os, sys, string
import MySQLdb

try:
    conn = MySQLdb.connect(host='127.0.0.1', port=3316, user='root', passwd='123456', db='test')
    cursor = conn.cursor()
except Exception, e:
    print e
    sys.exit()
    
sql = 'select * from T_USER'
cursor.execute(sql)
alldata = cursor.fetchall()

if alldata:
    for rec in alldata:
        print rec[0], rec[1], rec[2], rec[3]

cursor.close()
conn.close()


